package com.cloudsail.test;

import com.alibaba.fastjson.JSON;
import com.cloudsail.api.dto.RaffleAwardListRequestDTO;
import com.cloudsail.infrastructure.redis.IRedisService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.redisson.api.RMap;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;

@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class ApiTest {

    @Resource
    IRedisService redisService;

    @Test
    public void test() {
        RMap<Object, Object> rMap = redisService.getMap("test");
        rMap.put(1, 101);
        log.info("测试完成{}", redisService.getFromMap("test", 1).toString());
    }

    @Test
    public void test2() {
        RaffleAwardListRequestDTO requestDTO = new RaffleAwardListRequestDTO();
        requestDTO.setUserId("xiaofuge");
        requestDTO.setActivityId(100301L);
        log.info(JSON.toJSONString(requestDTO));
    }


}
